{"version":3,"file":"static/chunks/pages/create-account/found-distance/[...pageId]-5e46ccd3d2cbbe89.js","mappings":"qFAAAA,EAAAC,OAAA,CAAAC,EAAA,8BCCA,CAAAC,OAAAC,QAAA,CAAAD,OAAAC,QAAA,MAAAC,IAAA,EACA,6CACA,WACA,OAAeH,EAAQ,MACvB,EACA,+ICDO,IAAMI,EAAkC,CAC7C,qCACA,qDACA,0CACD,CAQYC,EAA8B,CACzC,yBACA,mCACA,yBACD,CAQYC,EAA6B,CACxC,2CACA,8BACA,gDACD,CAOYC,EAAmC,CAC9C,+CACA,mCACA,yBACD,4GClCM,IAAMC,iBAAmB,UAC9B,GAAI,CAEF,IAAMC,EAAW,MAAMC,MAAM,GAAiBC,MAAA,CAAdC,CAAAA,EAAAA,EAAAA,CAAAA,IAAc,uBAExCC,EAAe,MAAMJ,EAASK,IAAI,GACxC,OAAOC,QAAQC,OAAO,CAACH,EAAaI,OAAO,CAACC,OAAO,CACrD,CAAE,MAAOC,EAAO,CACd,OAAOJ,QAAQK,MAAM,CAACD,EACxB,CACF,yFCZe,eAAeE,MAAMC,CAAiB,EACnD,GAAI,CACF,IAAMC,EAA6B,MAAMC,EAAAA,CAAGA,CACzCD,EAAE,CAAC,CAAED,UAAWA,CAAU,GAC1BG,IAAI,GACDC,EAAOH,EAAGG,IAAI,CACpB,OAAOA,CACT,CAAE,MAAOP,EAAO,CAEd,MAAMA,CACR,CACF,mGCPO,eAAeQ,gBACpBD,CAAiC,EAEjC,GAAI,CACF,OAAO,MAAMF,EAAAA,CAAGA,CAACG,eAAe,GAAGA,eAAe,CAACD,EACrD,CAAE,MAAOP,EAAO,CAEd,MAAMA,CACR,CACF,8JCiBA,IAAMS,EAAmBC,CAAAA,EAAAA,EAAAA,aAAAA,EAAqC,CAC5DC,YAAa,EACf,GAwBuB,IAAIC,EAAAA,CAAcA,CAyHlC,IAAMC,wBAA0B,KACrC,IAAMC,EAAmBC,CAAAA,EAAAA,EAAAA,UAAAA,EAAWN,GAC9B,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MACE,GAAAlH,EAAAkL,IAAA,EAACC,EAAAA,EAAqBA,CAAAA,CACpB1G,OAAQA,EACRI,OAAQA,EACRC,aAAcA,EACdsG,YAAa,CACXC,eAAgBhE,EAClB,YAEA,GAAArH,EAAAC,GAAA,EAACqL,EAAAA,CAAIA,CAAAA,CACHC,MAAM,8CACNC,QAAS,KAEV/F,GAAkBE,GACjB,GAAA3F,EAAAC,GAAA,EAACwL,MAAAA,CAAIC,UAAU,yFACb,GAAA1L,EAAAC,GAAA,EAAC0L,EAAAA,EAAmBA,CAAAA,CAAE,GAAGhG,CAAkB,KAG9C,CAACF,GACA,GAAAzF,EAAAC,GAAA,EAAC2L,EAAAA,CAAmBA,CAAAA,CAElB3G,QAASA,EACT4G,eAAgBtE,GAChBuE,qBAAsB7G,EACtB8G,cAAe,CAAEC,WAAY,GAAMC,UAAW,EAAK,GAJ9CpH,KASf","sources":["webpack://_N_E/./node_modules/@auth0/nextjs-auth0/client.js","webpack://_N_E/?e650","webpack://_N_E/./src/lib/constants/constants/articles.ts","webpack://_N_E/./src/lib/dataSource/auth/getIdToken.ts","webpack://_N_E/./src/lib/dataSource/lostApi/auth/me.ts","webpack://_N_E/./src/lib/dataSource/lostApi/auth/registerWithPet.ts","webpack://_N_E/./src/lib/hooks/useStorybookAuth/StorybookAuth.tsx","webpack://_N_E/./src/lib/hooks/me/useMe.ts","webpack://_N_E/./src/lib/hooks/persistentBanner/PersistentBanner.tsx","webpack://_N_E/./src/lib/utils/analytics/loggedInStore.ts","webpack://_N_E/./src/lib/utils/analytics/startPetSearch.ts","webpack://_N_E/./src/lib/utils/analytics/userSignUp.ts","webpack://_N_E/./src/lib/utils/auth/loginAndRedirect.ts","webpack://_N_E/./src/lib/utils/getBaseUrl/getBaseUrl.ts","webpack://_N_E/./src/lib/utils/getPetUrlPath/getPetUrlPath.ts","webpack://_N_E/./src/pages/create-account/found-distance/[...pageId].tsx","webpack://_N_E/<anon>"],"sourcesContent":["module.exports = require('./dist/client');\n","\n (window.__NEXT_P = window.__NEXT_P || []).push([\n \"/create-account/found-distance/[...pageId]\",\n function () {\n return require(\"private-next-pages/create-account/found-distance/[...pageId].tsx\");\n }\n ]);\n if(module.hot) {\n module.hot.dispose(function () {\n window.__NEXT_P.push([\"/create-account/found-distance/[...pageId]\"])\n });\n }\n ","/**\n * Array of the article slug names to display in the shelter details page\n *\n * @constant {string[]}\n */\nexport const shelterDetailsArticlesSlugNames = [\n 'lost-dog-reunites-with-best-friend',\n 'how-to-care-for-your-lost-cat-after-they-come-home',\n 'how-to-help-lost-and-found-pets-near-me',\n];\n\n/**\n * The article slug names for the found search; If the user is searching for\n * FOUND pets, that means the user LOST a pet\n *\n * @constant {string[]} foundSearchArticleSlugNames\n */\nexport const foundSearchArticleSlugNames = [\n 'how-to-find-a-lost-dog',\n 'do-lost-pets-find-their-way-home',\n 'how-to-find-a-lost-cat',\n];\n\n/**\n * The article slug names for the lost search; If the user is searching for LOST\n * pets, that means the user FOUND a pet\n *\n * @constant {string[]} lostSearchArticleSlugNames\n */\nexport const lostSearchArticleSlugNames = [\n 'what-to-do-if-you-find-a-lost-cat-or-dog',\n 'how-to-catch-a-shy-lost-dog',\n 'are-stray-cats-and-dogs-potentially-lost-pets',\n];\n\n/**\n * The article slug names for the microchip search page\n *\n * @constant {string[]} microchipSearchArticlesSlugNames\n */\nexport const microchipSearchArticlesSlugNames = [\n 'what-is-a-pet-microchip-and-how-does-it-work',\n 'do-lost-pets-find-their-way-home',\n 'how-to-find-a-lost-cat',\n];\n","import getBasePath from '@/lib/utils/getBasePath/getBasePath';\nimport { getSession } from '@auth0/nextjs-auth0';\nimport { NextApiRequest, NextApiResponse } from 'next';\n\n/**\n * Get the idToken from the session for the current user. This can be used to\n * authenticate api calls. This should be used in the client side code.\n *\n * @returns {Promise<string>} - The idToken for the current user.\n */\nexport const getIdTokenClient = async (): Promise<string> => {\n try {\n /** Fetch the session from the api. */\n const response = await fetch(`${getBasePath()}/api/auth/session/`);\n /** Get the JSON from the response. */\n const jsonResponse = await response.json();\n return Promise.resolve(jsonResponse.session.idToken);\n } catch (error) {\n return Promise.reject(error);\n }\n};\n\n/**\n * Get the idToken from the session for the current user. This can be used to\n * authenticate backend api calls. This should be used in the server side code.\n *\n * @param {NextApiRequest} req - The request object.\n * @param {NextApiResponse} res - The response object.\n * @returns {string | null} The idToken for the current user.\n */\nexport const getIdTokenSSR = async (\n req: NextApiRequest,\n res: NextApiResponse\n): Promise<string | null> => {\n try {\n /** Fetch the session from the api. */\n const session = await getSession(req, res);\n if (session && session.idToken) {\n return session.idToken;\n }\n return null;\n } catch (error) {\n return null;\n }\n};\n","import { sdk } from '@/lib/dataSource/lostApi/common';\nimport { IServiceMethodResponse } from '@petcolove/lost--client--api-sdk/dist/abstract/service/interfaces';\nimport { IMeDto } from '@petcolove/lost--client--api-sdk/dist/concrete/sdks/services/auth/dto';\n\n/**\n * @param {string} authToken - This is the auth token for the current user\n * @returns {Promise<IMeDto>} The details of the current user\n */\nexport default async function getMe(authToken: string): Promise<IMeDto> {\n try {\n const me: IServiceMethodResponse = await sdk\n .me({ authToken: authToken })\n .read();\n const data = me.data as IMeDto;\n return data;\n } catch (error) {\n console.error(error);\n throw error;\n }\n}\n","import {\n IRegisterWithPetRequestData,\n IRegisterWithPetResponse,\n} from '@petcolove/lost--client--api-sdk/dist/concrete/sdks/services/auth/interfaces';\nimport { sdk } from '../common';\n\n/**\n * Register a new user with pet\n *\n * @param {IRegisterWithPetRequestData} data - The user register data\n * @returns {Promise<IRegisterWithPetResponse>} The response\n */\nexport async function registerWithPet(\n data: IRegisterWithPetRequestData\n): Promise<IRegisterWithPetResponse> {\n try {\n return await sdk.registerWithPet().registerWithPet(data);\n } catch (error) {\n console.error(error);\n throw error;\n }\n}\n","import AbstractStorage from '@/lib/utils/storage/abstract-storage';\nimport SessionStorage from '@/lib/utils/storage/session-storage';\nimport React, { createContext, useContext, useEffect, useState } from 'react';\n\n/**\n * Describe the storybook user context\n *\n * @interface IStorybookAuthContext\n */\ninterface IStorybookAuthContext {\n /**\n * A flag to determine if is storybook\n *\n * @memberof IStorybookAuthContext\n * @member {boolean} isStorybook\n */\n isStorybook: boolean;\n /**\n * The id token\n *\n * @memberof IStorybookAuthContext\n * @member {string | null} [idToken]\n */\n idToken?: string | null;\n /**\n * Set the id token\n *\n * @memberof IStorybookAuthContext\n * @member {(idToken: string) => void} [setIdToken]\n */\n setIdToken?: (idToken: string) => void;\n}\n\n/**\n * The storybook context\n *\n * @constant {React.Context<IStorybookAuthContext>} StorybookContext\n */\nconst StorybookContext = createContext<IStorybookAuthContext>({\n isStorybook: false,\n});\n\n/**\n * The storybook user context provider props\n *\n * @interface IStorybookAuthContextProviderProps\n */\ninterface IStorybookAuthContextProviderProps {\n /**\n * The provider children\n *\n * @memberof IStorybookAuthContextProviderProps\n * @member {React.ReactNode} children\n */\n children: React.ReactNode;\n /**\n * The id token storage\n *\n * @memberof IStorybookAuthContextProviderProps\n * @member {AbstractStorage} [idTokenStorage]\n */\n idTokenStorage?: AbstractStorage;\n}\n\nconst defaultStorage = new SessionStorage();\n\n/**\n * The hook to use the stored id token\n *\n * @interface IUseStoredIdToken\n */\ninterface IUseStoredIdToken {\n /**\n * The id token\n *\n * @memberof IUseStoredIdToken\n * @member {string | null} idToken\n */\n idToken: string | null;\n /**\n * The setter function for the id token that also stores it in the storage\n *\n * @memberof IUseStoredIdToken\n * @member {(idToken: string) => void} setIdToken\n * @param idToken\n * @returns {void}\n */\n setIdToken: (idToken: string | null) => void;\n /**\n * The storage key for the id token\n *\n * @memberof IUseStoredIdToken\n * @member {string} storageKey\n */\n storageKey: string;\n}\n\n/**\n * The hook to use the stored id token\n *\n * @param {AbstractStorage} storage - The storage\n * @returns {IUseStoredIdToken} - The stored id token\n */\nexport const useStoredIdToken = (\n storage: AbstractStorage = defaultStorage\n): IUseStoredIdToken => {\n /**\n * The storage key for the id token\n *\n * @constant {string} storageKey\n */\n const storageKey = 'idToken';\n\n const [idToken, _setIdToken] = useState<string | null>(null);\n\n /** Hook retrieve the stored id token from storage */\n useEffect(() => {\n /**\n * The store id token\n *\n * @constant {string} storedIdToken\n */\n const storedIdToken = storage.get(storageKey);\n\n if (storedIdToken && typeof storedIdToken === 'string') {\n _setIdToken(storedIdToken);\n }\n }, [_setIdToken, storage]);\n\n /**\n * The setter function for the id token that also stores it in the storage\n *\n * @param {string} idToken - The id token\n */\n const setIdToken = (idToken: string | null) => {\n idToken === null\n ? storage.delete(storageKey)\n : storage.set(storageKey, idToken);\n\n _setIdToken(idToken);\n };\n\n return {\n idToken,\n setIdToken,\n storageKey,\n };\n};\n\n/**\n * The storybook provider\n *\n * @param {IStorybookAuthContextProviderProps} props - The props\n * @returns {React.ReactElement} - The storybook provider\n */\nexport const StorybookProvider = ({\n children,\n idTokenStorage,\n}: IStorybookAuthContextProviderProps) => {\n /**\n * The flag to determine if is storybook\n *\n * @constant {boolean} isStorybook\n */\n const isStorybook = process.env.STORYBOOK_BASE_URL !== undefined;\n const { idToken, setIdToken } = useStoredIdToken(idTokenStorage);\n\n return (\n <StorybookContext.Provider\n value={{\n setIdToken,\n idToken,\n isStorybook,\n }}\n >\n {children}\n </StorybookContext.Provider>\n );\n};\n\n/**\n * Use the storybook user context\n *\n * @returns {IStorybookAuthContext} - The storybook user context\n */\nexport const useStorybookAuthContext = (): IStorybookAuthContext => {\n const storybookContext = useContext(StorybookContext);\n const { isStorybook } = storybookContext;\n\n return isStorybook ? storybookContext : { isStorybook };\n};\n","import { getIdTokenClient } from '@/lib/dataSource/auth/getIdToken';\nimport getMe from '@/lib/dataSource/lostApi/auth/me';\nimport { usePersistentBannerContext } from '@/lib/hooks/persistentBanner/PersistentBanner';\nimport { useStorybookAuthContext } from '@/lib/hooks/useStorybookAuth/StorybookAuth';\nimport { tomorrow } from '@/lib/utils/helpers/dateHelpers/dates';\nimport SessionStorage from '@/lib/utils/storage/session-storage';\nimport { useUser } from '@auth0/nextjs-auth0/client';\nimport { IMeDto } from '@petcolove/lost--client--api-sdk/dist/concrete/sdks/services/auth/dto';\nimport { useRouter } from 'next/router';\nimport { useEffect, useState } from 'react';\n\ndeclare global {\n // eslint-disable-next-line jsdoc/require-jsdoc\n interface Window {\n // eslint-disable-next-line jsdoc/require-jsdoc\n dataLayer: Array<{ user_id: number } | object>;\n }\n}\n\n/**\n * Store Me This is used to deal with the session storage for me object\n *\n * @class MeStorage\n */\nexport class MeStorage {\n /** The session storage used in the class */\n readonly meStorage = new SessionStorage();\n\n /** The key to use for the storage */\n readonly meStorageKey = 'me';\n\n /**\n * A method used to store the me data in session storage\n *\n * @param {IMeDto} me - The me data to store\n */\n public set = (me: IMeDto) => {\n this.meStorage.set(this.meStorageKey, me, { expires: tomorrow });\n };\n\n /** A method used to remove the me data from session storage */\n public delete = () => {\n this.meStorage.delete(this.meStorageKey);\n };\n\n /**\n * A method used to get the me data from session storage\n *\n * @returns {IMeDto | null} The me data\n */\n public get = (): IMeDto | null => {\n return this.meStorage.get(this.meStorageKey) as IMeDto;\n };\n}\n\n/**\n * IUseMe\n *\n * @interface IUseMe\n */\nexport interface IUseMe {\n /**\n * The me object\n *\n * @memberof IUseMe\n * @member {IMeDto | null} [me]\n */\n me?: IMeDto | null;\n /**\n * The idToken\n *\n * @memberof IUseMe\n * @member {string} [idToken]\n */\n idToken?: string;\n /**\n * Indicates if the user is being fetched\n *\n * @memberof IUseMe\n * @member {boolean} [isFetchingUser]\n */\n isFetchingUser: boolean;\n /**\n * Is in error state\n *\n * @memberof IUseMe\n * @member {boolean} [isError]\n */\n isError?: boolean;\n /**\n * The error message\n *\n * @memberof IUseMe\n * @member {string} [errorMessage]\n */\n errorMessage?: string;\n}\n\n/** The me storage */\nconst meStorage = new MeStorage();\n\n/**\n * Hook to get the me object and the idToken\n *\n * @returns {IUseMe} Me - The me object\n */\nconst useMe = (): IUseMe => {\n const [idToken, setIdToken] = useState<string>();\n const [me, setMe] = useState<IMeDto | null>();\n const [isFetchingUser, setIsFetchingUser] = useState(true);\n const [isError, setIsError] = useState(false);\n const [errorMessage, setErrorMessage] = useState<string>();\n const { user, isLoading } = useUser();\n const router = useRouter();\n const { type, setBannerData } = usePersistentBannerContext();\n /**\n * @property {string | null} idTokenOverride - The id token from the storybook\n * auth context to override the id token\n * @property {boolean} isStorybook - The flag to determine if the hook is\n * being used in storybook\n */\n const { idToken: idTokenOverride, isStorybook } = useStorybookAuthContext();\n\n /**\n * A hook to override the id token\n *\n * This hook is setup to be used only inside storybook\n */\n useEffect(() => {\n if (idTokenOverride && isStorybook) {\n setIdToken(idTokenOverride);\n setIsError(false);\n setErrorMessage('');\n }\n }, [idTokenOverride, isStorybook]);\n\n /** Hook to get the idToken */\n useEffect(() => {\n if (!isLoading && user && !isStorybook) {\n getIdTokenClient()\n .then((idToken) => {\n setIdToken(idToken);\n setIsError(false);\n setErrorMessage('');\n })\n .catch((error) => {\n setIsError(true);\n setErrorMessage(error.message);\n console.error(error);\n });\n } else {\n /** If there is no user, than there should never be a warning banner */\n if (type === 'warning') {\n setBannerData();\n }\n /** Clear the me object in session storage if there is no user */\n meStorage.delete();\n }\n\n if (isStorybook) {\n setIsError(false);\n setErrorMessage('');\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [user, isLoading, isStorybook]);\n\n /** Hook to clear the isFetchingUser flag when there is no logged in user */\n useEffect(() => {\n if ((!isLoading && !user) || isError) {\n setIsFetchingUser(false);\n }\n }, [isLoading, user, router, isError]);\n\n /** Hook to get the me object */\n useEffect(() => {\n if (!idToken || isError) return;\n\n /** Check if we have the me object in session storage */\n let storedMe = meStorage.get();\n\n /**\n * Check the email of the me object in session storage and the email of the\n * useUser hook to check for equality if they are not equal it will clear\n * the data in storage\n */\n if (storedMe?.user?.email !== user?.email) {\n /** Clear the me object in session storage */\n meStorage.delete();\n /**\n * Set stored me to null, since there is no need to try to fetch it from\n * storage if we know it has just been cleared\n */\n storedMe = null;\n }\n\n /**\n * If idToken is available and the me key in session storage is not\n * available it will use getMe call to set the me key in session storage\n */\n if (!storedMe && idToken && !isError) {\n getMe(idToken)\n .then((me) => {\n setMe(me);\n meStorage.set(me);\n })\n .catch((error) => {\n setIsError(true);\n setErrorMessage(error.message);\n setMe(null);\n meStorage.delete();\n })\n .finally(() => {\n setIsFetchingUser(false);\n });\n } else {\n /**\n * If there is not need to re-fetch the me object, clear the\n * isFetchingUser flag\n */\n setMe(storedMe);\n setIsFetchingUser(false);\n setIsError(false);\n setErrorMessage('');\n }\n }, [idToken, user?.email, isError]);\n\n /** Hook to set the user id in the data layer if available */\n useEffect(() => {\n if (isError) return;\n if (me?.user?.id) {\n // Set dataLayer\n window.dataLayer = window.dataLayer || [];\n // Check if user id is already set\n const userAlreadySet = window.dataLayer.some(\n (el) => 'user_id' in el && el.user_id === me.user.id\n );\n\n if (!userAlreadySet) {\n window.dataLayer.push({\n user_id: me.user.id,\n });\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [router, isError]);\n\n return {\n me,\n idToken,\n isFetchingUser,\n isError,\n errorMessage,\n };\n};\n\nexport default useMe;\n","import { PetSpecies } from '@/components/molecules/ShelterPetCard/ShelterPetCard';\nimport { tomorrow } from '@/lib/utils/helpers/dateHelpers/dates';\nimport LocalStorage from '@/lib/utils/storage/local-storage';\nimport {\n createContext,\n ReactNode,\n useContext,\n useEffect,\n useState,\n} from 'react';\n\n/**\n * The banner storage class is used to deal with the storage for the persistent\n * banner\n */\nexport class BannerStorage {\n /** The storage used in the class */\n readonly storage = new LocalStorage();\n\n /** The key used for the storage */\n readonly key = 'banner';\n\n /**\n * A method used to store the banner data in storage\n *\n * @param {IBannerStorage} data - The banner data to store\n */\n public set = (data: IBannerStorage) => {\n this.storage.set(this.key, data, { expires: tomorrow });\n };\n\n /** A method used to remove the banner data from storage */\n public delete = () => {\n this.storage.delete(this.key);\n };\n\n /**\n * A method used to get the banner data from storage\n *\n * @returns {IBannerStorage | null} The banner props data\n */\n public get = (): IBannerStorage | null => {\n return this.storage.get(this.key) as IBannerStorage;\n };\n}\n\n/**\n * The interface for the banner storage\n *\n * @interface IBannerStorage\n */\ninterface IBannerStorage {\n /**\n * The type of banner to display\n *\n * @memberof IBannerStorage\n * @member {PersistentBannerTypes} [type]\n */\n type?: PersistentBannerTypes;\n /**\n * The props for the banner\n *\n * @memberof IBannerStorage\n * @member {BannerProps} [bannerProps]\n */\n bannerProps?: BannerProps;\n}\n\n/**\n * The types of banners that can be returned\n *\n * @typedef {string} PersistentBannerTypes\n */\nexport type PersistentBannerTypes = 'info' | 'warning' | 'partner';\n\n/**\n * The types of searches that can be done\n *\n * @typedef {string} SearchTypes\n */\nexport type SearchTypes = 'distance' | 'photo';\n\n/**\n * The type of pet reports\n *\n * @typedef {string} PetReportTypes\n */\nexport type PetReportTypes = 'lost' | 'found';\n\n/**\n * The type of pet reports\n *\n * @type {CreateAccountBannerProps | PetSearchBannerProps | PartnerBannerProps} BannerProps\n */\nexport type BannerProps =\n | CreateAccountBannerProps\n | PetSearchBannerProps\n | PartnerBannerProps;\n\n/**\n * The interface for the PersistentBannerHandler props used to display the\n * Create Account Banner\n *\n * @interface CreateAccountBannerProps\n */\nexport interface CreateAccountBannerProps {\n /**\n * The type of pet report\n *\n * @memberof CreateAccountBannerProps\n * @member {PetReportTypes} petReportType\n */\n petReportType: PetReportTypes;\n /**\n * The type of search\n *\n * @memberof CreateAccountBannerProps\n * @member {SearchTypes} searchType\n */\n searchType: SearchTypes;\n /**\n * The Pet species\n *\n * @memberof CreateAccountBannerProps\n * @member {PetSpecies} [species]\n */\n species?: PetSpecies;\n}\n\n/**\n * The interface for the PartnerBannerProps props used to display the Partner\n * Banner\n *\n * @interface PartnerBannerProps\n */\nexport interface PartnerBannerProps {\n /**\n * The partner name\n *\n * @memberof PartnerBannerProps\n * @member {string} partner\n */\n partner: string;\n\n /**\n * The type of pet report\n *\n * @memberof PartnerBannerProps\n * @member {PetReportTypes} petReportType\n */\n petReportType: PetReportTypes;\n}\n\n/**\n * The interface for the PersistentBannerHandler props used to display the Pet\n * Search Banner\n *\n * @interface PetSearchBannerProps\n */\nexport interface PetSearchBannerProps {\n /**\n * The Id of the pet, this is used for analytics\n *\n * @memberof PetSearchBannerProps\n * @member {number} [petId]\n */\n petId?: number;\n /**\n * The zip code of the pet, this is used for analytics\n *\n * @memberof PetSearchBannerProps\n * @member {string} [zipCode]\n */\n zipCode?: string;\n /**\n * The name of the pet, this is used for analytics\n *\n * @memberof PetSearchBannerProps\n * @member {string} [petName]\n */\n petName?: string;\n /**\n * The type of pet report\n *\n * @memberof PetSearchBannerProps\n * @member {PetReportTypes} petReportType\n */\n petReportType: PetReportTypes;\n /**\n * The pet data\n *\n * @memberof PetSearchBannerProps\n * @member {object} petData\n */\n petData: {\n /**\n * The Pet photo\n *\n * @memberof PetSearchBannerProps.petData\n * @member {string} photo\n */\n photo: string;\n /**\n * The pet species\n *\n * @memberof PetSearchBannerProps.petData\n * @member {PetSpecies} species\n */\n species: PetSpecies;\n /**\n * The coordinates for the user\n *\n * @memberof PetSearchBannerProps.petData\n * @member {object} coordinates\n */\n coordinates: {\n /**\n * The latitude\n *\n * @memberof PetSearchBannerProps.petData.coordinates\n * @member {number} latitude\n */\n latitude: number;\n /**\n * The longitude\n *\n * @memberof PetSearchBannerProps.petData.coordinates\n * @member {number} longitude\n */\n longitude: number;\n };\n /**\n * The label of the address of the pet\n *\n * @memberof PetSearchBannerProps.petData\n * @member {string} [address]\n */\n address?: string;\n };\n}\n\n/**\n * The interface for the PersistentBannerProvider props\n *\n * @interface IPersistentBannerContext\n */\nexport interface IPersistentBannerContext {\n /**\n * The type of banner\n *\n * @memberof IPersistentBannerContext\n * @member {PersistentBannerTypes} [type]\n */\n type?: PersistentBannerTypes;\n /**\n * The props used to create the banner\n *\n * @memberof IPersistentBannerContext\n * @member {BannerProps} [bannerProps]\n */\n bannerProps?: BannerProps;\n /**\n * The function to set the banner data\n *\n * @memberof IPersistentBannerContext\n * @member {Function} setBannerData\n */\n setBannerData: (\n type?: PersistentBannerTypes,\n bannerProps?: BannerProps\n ) => void;\n}\n\nconst PersistentBannerContext = createContext<IPersistentBannerContext>({\n type: undefined,\n bannerProps: undefined,\n /** The function to set the banner data */\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n setBannerData: () => {},\n});\n\n/**\n * The interface for the PersistentBannerProvider props\n *\n * @interface IPersistentBannerProvider\n */\ninterface IPersistentBannerProvider {\n /**\n * The children wrapped by the provider\n *\n * @memberof IPersistentBannerProvider\n * @member {ReactNode} children\n */\n children: ReactNode;\n}\n\n/**\n * The PersistentBannerProvider component.\n *\n * @param {IPersistentBannerProvider} props - The props for the\n * PersistentBannerProvider.\n * @returns {Element} - The PersistentBannerProvider.\n */\nexport function PersistentBannerProvider({\n children,\n}: IPersistentBannerProvider): JSX.Element {\n const storage = new BannerStorage();\n const [type, setType] = useState<PersistentBannerTypes>();\n const [bannerProps, setBannerProps] = useState<BannerProps>();\n\n useEffect(() => {\n const data = storage.get();\n if (data && !type && !bannerProps) {\n setType(data.type);\n setBannerProps(data.bannerProps);\n }\n // This only needs to run on render once since we do not want to continuously look in the storage.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n /**\n * This function is used to set the banner data\n *\n * @param {PersistentBannerTypes} type - The type of banner\n * @param {BannerProps} bannerProps - The props for the banner\n */\n const setBannerData = (\n type?: PersistentBannerTypes,\n bannerProps?: BannerProps\n ): void => {\n setType(type);\n setBannerProps(bannerProps);\n storage.set({ type, bannerProps });\n };\n\n return (\n <PersistentBannerContext.Provider\n value={{ type, bannerProps, setBannerData }}\n >\n {children}\n </PersistentBannerContext.Provider>\n );\n}\n\n/**\n * A hook to access the PersistentBannerContext\n *\n * @returns {IPersistentBannerContext} - The PersistentBannerContext\n */\nexport const usePersistentBannerContext = (): IPersistentBannerContext =>\n useContext(PersistentBannerContext);\n","import { tomorrow } from '@/lib/utils/helpers/dateHelpers/dates';\nimport SessionStorage from '@/lib/utils/storage/session-storage';\n\n/**\n * The interface for the login storage.\n *\n * @interface ILogin\n */\nexport interface ILogin {\n /** Whether or not the login event has been sent. */\n init: boolean;\n /** The user id */\n userId?: string;\n}\n\n/**\n * Logged In Store\n *\n * - This is used to deal with the session storage surround the login event being\n * sent to GTAG\n *\n * @class LoggedInStore\n */\nexport default class LoggedInStore {\n /** The session storage */\n private storage: SessionStorage;\n\n /** LoggedInStore constructor */\n constructor() {\n this.storage = new SessionStorage();\n }\n\n /** @param {number} userId The optional user id to be stored */\n public setLoggedIn(userId?: number) {\n this.storage.set('login', { init: true }, { expires: tomorrow });\n /** If the user Id is also passed in then store that as well */\n if (userId) {\n this.storage.set('login', { init: true, userId }, { expires: tomorrow });\n }\n }\n\n /**\n * Get the login information from the session storage\n *\n * @returns {ILogin} The login object\n */\n public getLoggedIn(): ILogin {\n const login: ILogin = this.storage.get('login') as ILogin;\n return login;\n }\n\n /** Clear the login information from the session storage */\n public clearLoggedIn() {\n this.storage.delete('login');\n }\n}\n","import { defaultEventEmitter } from '@/lib/analytics/commonEmitter';\nimport { IEvent } from '@/lib/analytics/handlers/abstractAnalyticsHandler';\nimport { AnalyticsInitiatingComponent } from '@/lib/storageClasses/analyticsEventStorage';\n\n/**\n * The flow type\n *\n * @type {Flow}\n */\ntype Flow = 'Lost' | 'Found' | 'All';\n\n/**\n * The event name\n *\n * @constant {string}\n */\nconst eventName = 'start_pet_search';\n\n/**\n * The interface for the user sign up event\n *\n * @interface IUserSignUpEvent\n */\nexport interface IStartPetSearchEvent {\n /** The clicked text */\n clickText: string;\n /** The search flow */\n flow: Flow;\n /** The component used to start event */\n component: AnalyticsInitiatingComponent;\n}\n\n/**\n * Handle the user sign up event\n *\n * @param {IStartPetSearchEvent} params - The event params\n */\nexport const startPetSearchEventHandler = ({\n clickText,\n flow,\n component,\n}: IStartPetSearchEvent) => {\n const eventData: IEvent = {\n name: eventName,\n data: {\n click_text: clickText,\n flow_type: flow,\n component,\n },\n };\n defaultEventEmitter.handleEvent(eventData);\n};\n","import { defaultEventEmitter } from '@/lib/analytics/commonEmitter';\nimport { IEvent } from '@/lib/analytics/handlers/abstractAnalyticsHandler';\nimport {\n notApplicableString,\n petListingTypeToPetStatusMap,\n} from '@/lib/constants/constants/analytics';\nimport {\n InferredSpecies,\n UserPetListingType,\n} from '@/lib/constants/types/pets';\nimport capitalizeFirstLetter from '@/lib/utils/helpers/stringHelpers/capitalizeFirstLetter';\n\n/**\n * The flow types for the account creation from a report\n *\n * @type {ReportFlowType}\n */\ntype ReportFlowType = 'Found-Report Contact' | 'Lost-Report Contact';\n\n/**\n * The flow type for the account creation from a search\n *\n * @type {SearchFlowType}\n */\ntype SearchFlowType =\n | 'Found-Distance'\n | 'Found-Photo'\n | 'Lost-Distance'\n | 'Lost-Photo';\n\n/**\n * The flow type for the account creation from a create account\n *\n * @type {CreateAccountFlowType}\n */\ntype CreateAccountFlowType =\n | 'Lost-Create Account'\n | 'Found-Create Account'\n | 'Safe at Home-Create Account';\n\n/**\n * The flow type for the account creation from a activate account\n *\n * @type {'Shelter Adopter Lead-Activate Account'}\n */\ntype ActivateAccountFlowType = 'Shelter Adopter Lead-Activate Account';\n\n/**\n * The flow type for the account creation\n *\n * @type {ReportFlowType | SearchFlowType | CreateAccountFlowType}\n */\nexport type FlowType =\n | ReportFlowType\n | SearchFlowType\n | CreateAccountFlowType\n | ActivateAccountFlowType;\n\n/**\n * The event name\n *\n * @constant {string}\n */\nconst eventName = 'user_sign_up';\n\n/**\n * The pet listing source\n *\n * @constant {string}\n */\nconst petListingSource = 'Consumer Pet Listing';\n\n/**\n * The interface for the user sign up event\n *\n * @interface IUserSignUpEvent\n */\nexport interface IUserSignUpEvent {\n /** The clicked text */\n clickText: string;\n /** The flow type of the event */\n flowType: FlowType;\n /** The optional id of the pet created with the account */\n petId?: number;\n /** The optional name of the pet created with the account */\n petName?: string;\n /** The optional status of the pet created with the account */\n petListingType?: UserPetListingType;\n /** The optional species of the pet created with the account */\n species?: InferredSpecies;\n /** The optional zip code of the pet created with the account */\n postalCode?: string;\n}\n\n/**\n * Handle the user sign up event\n *\n * @param {IUserSignUpEvent} params - The event params\n */\nexport const userSignUpEventHandler = ({\n clickText,\n flowType,\n petId,\n petName,\n petListingType,\n species,\n postalCode,\n}: IUserSignUpEvent) => {\n const eventData: IEvent = {\n name: eventName,\n data: {\n click_text: clickText,\n flow_type: flowType,\n items: [\n {\n listing_source: petListingSource,\n pet_id: petId || notApplicableString,\n pet_name: petName || notApplicableString,\n pet_status: petListingType\n ? petListingTypeToPetStatusMap[petListingType]\n : notApplicableString,\n species: species\n ? capitalizeFirstLetter(species)\n : notApplicableString,\n location_id: postalCode || notApplicableString,\n },\n ],\n },\n };\n defaultEventEmitter.handleEvent(eventData);\n};\n","import getBasePath from '@/lib/utils/getBasePath/getBasePath';\n\n/** The interface for the loginAndRedirect function */\nexport interface ILoginAndRedirect {\n /** The email of the user */\n email: string;\n /** The password of the user */\n password: string;\n /** The redirect path */\n redirectPath: string;\n /**\n * The optional query string to append to the redirect This string should be\n * passed in as already encoded\n */\n queryString?: string;\n}\n\n/**\n * The login path\n *\n * @constant {string}\n */\nconst loginBasePath = `${getBasePath()}/api/auth/login-flow`;\n\n/**\n * Get the url to log the user in and redirect them to the specified path This\n * is typically used at the end of a registration flow.\n *\n * @param {ILoginAndRedirect} params - The params to get the login and redirect\n * url\n * @returns {string} - The login and redirect URL\n */\nexport const getLoginAndRedirectUrl = ({\n email,\n password,\n redirectPath,\n queryString,\n}: ILoginAndRedirect) => {\n return `${loginBasePath}?email=${encodeURIComponent(\n email\n )}&password=${encodeURIComponent(password)}&redirectTo=${encodeURIComponent(\n getBasePath() + redirectPath\n )}${queryString ? `%3F${queryString}` : ''}`;\n};\n\n/**\n * LoginAndRedirect - Logs the user in and redirects them to the specified path\n * This is typically used at the end of a registration flow.\n *\n * @param {ILoginAndRedirect} params - The props as clarified in the\n * ILoginAndRedirect interface\n */\nexport const loginAndRedirect = (params: ILoginAndRedirect) => {\n window.location.href = getLoginAndRedirectUrl(params);\n};\n","/**\n * Return the base URL for the application. Will look for the\n * NEXT_PUBLIC_BASE_URL environment variable and then for STORYBOOK_BASE_URL. If\n * none exist, will fallback to '/'\n *\n * @returns {string} The base URL.\n */\nexport default function getBaseUrl(): string {\n return (\n process.env.NEXT_PUBLIC_BASE_URL || process.env.STORYBOOK_BASE_URL || '/'\n );\n}\n","import {\n petUrlPathOwnerTypes,\n petUrlPathSearchTypes,\n} from '@/lib/constants/constants/pets';\nimport {\n ListingTypeKey,\n PetUrlPathOwnerSegment,\n SearchType,\n} from '@/lib/constants/types/pets';\nimport getBasePath from '@/lib/utils/getBasePath/getBasePath';\nimport { UserTypes } from '@petcolove/lost--client--api-sdk/dist/concrete/sdks/constants/types';\n\n/**\n * The valid pet url\n *\n * @type {string}\n */\nexport type PetUrl =\n `${string}/pet/${SearchType}/${PetUrlPathOwnerSegment}/${number}/`;\n\n/**\n * Get the owner type segment from the listing type\n *\n * @param {ListingTypeKey} listingType - The pet listing type\n * @returns {PetUrlPathOwnerSegment} The owner type segment\n */\nconst getOwnerTypeSegment = (\n listingType: ListingTypeKey\n): PetUrlPathOwnerSegment => {\n const ownerType: UserTypes = listingType.toLowerCase().includes('user')\n ? 'user'\n : 'awo';\n\n return petUrlPathOwnerTypes[ownerType];\n};\n\n/**\n * Describe the params for the getPetUrl function from a listing type\n *\n * @type {object}\n */\ntype IGetPetUrlFromListingTypeParams = {\n /** The pet listing type */\n listingType: ListingTypeKey;\n};\n\n/**\n * Describe the params for the getPetUrl function from a search type and owner\n * type\n *\n * @type {object}\n */\ntype IGetUrlFromSearchTypeAndOwnerParams = {\n /** The search type */\n searchType: SearchType;\n /** The owner type */\n ownerType: UserTypes;\n};\n\n/**\n * Describe the params for the getPetUrl function\n *\n * @type {object}\n */\ntype GetPetUrlParams = {\n /** The pet id */\n id: number;\n /** Optional flag to include base path in url */\n excludeBasePath?: boolean;\n} & (IGetPetUrlFromListingTypeParams | IGetUrlFromSearchTypeAndOwnerParams);\n\n/**\n * Get the pet url from the id and listing type\n *\n * @param {GetPetUrlParams} params - The params for the function\n * @returns {string} The pet url\n */\nexport default function getPetUrlPath(params: GetPetUrlParams): PetUrl {\n /**\n * The pet id\n *\n * @property {number} id - The pet id\n */\n const { id, excludeBasePath } = params;\n\n /** Get the pet url from the listing type */\n if ('listingType' in params) {\n const { listingType } = params as IGetPetUrlFromListingTypeParams;\n /**\n * The path url segment for the owner type\n *\n * @constant {PetUrlPathOwnerSegment} ownerTypeSegment\n */\n const ownerTypeSegment = getOwnerTypeSegment(listingType);\n /**\n * The path url segment for the search type\n *\n * @constant {SearchType} searchTypeSegment\n */\n const searchTypeSegment: SearchType = petUrlPathSearchTypes[listingType];\n\n return `${\n excludeBasePath ? '' : getBasePath()\n }/pet/${searchTypeSegment}/${ownerTypeSegment}/${id}/`;\n }\n /** Get The pet url from the search type and owner type */\n\n /**\n * The path url segment for the owner type\n *\n * @property {PetUrlPathOwnerSegment} ownerType - The owner type\n * @property {SearchType} searchType - The search type\n */\n const { searchType: petType, ownerType } =\n params as IGetUrlFromSearchTypeAndOwnerParams;\n\n return `${excludeBasePath ? '' : getBasePath()}/pet/${petType}/${\n petUrlPathOwnerTypes[ownerType]\n }/${id}/`;\n}\n\n/**\n * Interface for the getPetUrl function\n *\n * @interface IGetPetUrl\n */\nexport interface IGetPetUrl {\n /**\n * The pet id\n *\n * @memberof IGetPetUrl\n * @member {string | number} id\n */\n id: string | number;\n /**\n * The type of the pet\n *\n * @memberof IGetPetUrl\n * @member {'lost' | 'found' | 'sighting'} type\n */\n type: 'lost' | 'found' | 'sighting';\n /**\n * The owner type of the pet\n *\n * @memberof IGetPetUrl\n * @member {string} [ownerType]\n */\n ownerType?: string;\n /**\n * The external url of the pet\n *\n * @memberof IGetPetUrl\n * @member {string | null} [url]\n */\n url?: string | null;\n /**\n * The source of the external url\n *\n * @memberof IGetPetUrl\n * @member {string | null} [source]\n */\n source?: string | null;\n}\n\n/**\n * Build URL for different pet types, preferring the incoming external URL for\n * external pets.\n *\n * @param {IGetPetUrl} params - The params for the function\n * @returns {string} - The full pet URL the card will link to\n * @throws {Error} - If the pet has a non-numeric ID and no external URL\n */\nexport function getPetUrl({\n id,\n type,\n ownerType,\n url,\n source,\n}: IGetPetUrl): string {\n if (source) {\n if (url?.includes('/redirecting?')) {\n return url;\n }\n const params = new URLSearchParams();\n params.append('partner', source.toLowerCase());\n if (url?.includes('http')) {\n params.append('url', url);\n }\n if (!url) {\n params.append('url', '/');\n }\n return `${getBasePath()}/redirecting?${params.toString()}`;\n }\n\n if (url) {\n return url;\n }\n\n const idForRelativeLink = Number(id);\n const ownerTypeForLink = ownerType === 'partner' ? 'user' : ownerType;\n if (\n Number.isNaN(idForRelativeLink) ||\n type === 'sighting' ||\n (ownerTypeForLink !== 'user' && ownerTypeForLink !== 'awo')\n ) {\n throw new Error(\n `Cannot build details URL for pet ${id} with type ${type} and ownerType ${ownerType}`\n );\n }\n\n return getPetUrlPath({\n id: idForRelativeLink,\n searchType: type,\n ownerType: ownerTypeForLink,\n });\n}\n","import { ILocationDto } from '@/components/molecules/InputPlacesFieldGoogle/InputPlacesFieldGoogle';\nimport { noPartnerInterstitialMicrochipMatch } from '@/components/molecules/PartnerInterstitial/defaultValues';\nimport PartnerInterstitial, {\n getInterstitialDuration,\n IPartnerInterstitial,\n} from '@/components/molecules/PartnerInterstitial/PartnerInterstitial';\nimport { PetSpecies } from '@/components/molecules/ShelterPetCard/ShelterPetCard';\nimport { IOnCropFunctionResults } from '@/components/organisms/ImageUploadHandler/ImageUploadHandler';\nimport Head from '@/components/templates/Head/Head';\nimport StepperFormTemplate, {\n defaultSubmitLabel,\n} from '@/components/templates/StepperFormTemplate/StepperFormTemplate';\nimport { flagMicrochipCreationSearch } from '@/lib/constants/constants/featureFlags';\nimport { UnknownValueType } from '@/lib/constants/constants/pets';\nimport { PetSex } from '@/lib/constants/types/pets';\nimport { getIdTokenSSR } from '@/lib/dataSource/auth/getIdToken';\nimport getMe from '@/lib/dataSource/lostApi/auth/me';\nimport { registerWithPet } from '@/lib/dataSource/lostApi/auth/registerWithPet';\nimport PetCreateData from '@/lib/dataSource/users/pets/create';\nimport { useEventContext } from '@/lib/hooks/analytics/useEventContext';\nimport { useCheckSocialTargetMarket } from '@/lib/hooks/checkSocialTargetMarket/useCheckSocialTargetMarket';\nimport { PageTypes } from '@/lib/hooks/multiPageForm/configs/Configuration';\nimport { submitLabel } from '@/lib/hooks/multiPageForm/configs/CreateAccountFoundDistance';\nimport { storage as iFoundAPetStorage } from '@/lib/hooks/multiPageForm/configs/IFoundAPetConfiguration';\nimport {\n clearAllFormRelatedData,\n clearFormData,\n MultiPageFormProvider,\n} from '@/lib/hooks/multiPageForm/MultiPageForm';\nimport { useShelterReferral } from '@/lib/hooks/shelterReferral/ShelterReferral';\nimport useStorePets from '@/lib/hooks/storePets/useStorePets';\nimport { ToastType, useToastContext } from '@/lib/hooks/toasts/Toast';\nimport { useSaveToastToStorage } from '@/lib/hooks/toasts/ToastStorage';\nimport useGATrackingParams from '@/lib/hooks/useGATrackingParams/useGATrackingParams';\nimport { addPetEventHandler } from '@/lib/utils/analytics/addPet';\nimport { getClientIdFromCookie } from '@/lib/utils/analytics/getClientIdFromCookie';\nimport LoggedInStore from '@/lib/utils/analytics/loggedInStore';\nimport { uploadPhotoEventHandler } from '@/lib/utils/analytics/photoUpload';\nimport { reportPetEventHandler } from '@/lib/utils/analytics/reportPet';\nimport {\n IStartReportPetEventData,\n startReportPetEventHandler,\n} from '@/lib/utils/analytics/startReportPet';\nimport {\n FlowType as CreateAccountEventFlowType,\n userSignUpEventHandler,\n} from '@/lib/utils/analytics/userSignUp';\nimport { loginAndRedirect } from '@/lib/utils/auth/loginAndRedirect';\nimport { serverSideAllDecisions } from '@/lib/utils/featureFlags/optimizely/serverSideOptimizely';\nimport getGATrackingParams from '@/lib/utils/helpers/analytics/getGaTrackingParams';\nimport { microchipResultsUrl } from '@/lib/utils/helpers/microchipSearch/microchipResultsUrl';\nimport {\n formId as iFoundAPetFormStorageKey,\n iFoundAPetStorageKey,\n} from '@/pages/i-found-a-pet';\nimport { IRegisterWithPetRequestData } from '@petcolove/lost--client--api-sdk/dist/concrete/sdks/services/auth/interfaces';\nimport { GetServerSideProps, GetServerSidePropsContext, NextPage } from 'next';\nimport { useRouter } from 'next/router';\nimport { useCallback, useEffect, useState } from 'react';\n\n/**\n * The form Id is used to identify the form in the MultiPageFormProvider.\n *\n * @constant {string} formId\n */\nexport const formId = 'create-account/found-distance';\n\n/**\n * The flow type for the create account event\n *\n * @constant {CreateAccountEventFlowType} createAccountEventFlowType\n */\nconst createAccountEventFlowType: CreateAccountEventFlowType = 'Found-Distance';\n\n/**\n * ICreateAccountFoundDistanceForm Create Account Found Distance Form Interface\n *\n * @interface ICreateAccountFoundDistanceForm\n */\ninterface ICreateAccountFoundDistanceForm {\n /**\n * The page Id\n *\n * @memberof ICreateAccountFoundDistanceForm\n * @member {PageTypes} pageId\n */\n pageId: PageTypes;\n /**\n * The feature flags\n *\n * @memberof ICreateAccountFoundDistanceForm\n * @member {string[] | null} featureFlags\n */\n featureFlags: string[] | null;\n}\n\n/**\n * Interface for the form data\n *\n * @interface IFormData\n */\nexport interface IFormData {\n /**\n * The user's first name\n *\n * @memberof IFormData\n * @member {string} firstName\n */\n firstName: string;\n /**\n * The user's last name\n *\n * @memberof IFormData\n * @member {string} lastName\n */\n lastName: string;\n /**\n * The user's email\n *\n * @memberof IFormData\n * @member {string} email\n */\n email: string;\n /**\n * The user's password\n *\n * @memberof IFormData\n * @member {string} password\n */\n password: string;\n /**\n * The user's phone number\n *\n * @memberof IFormData\n * @member {string} phone\n */\n phone: string;\n /**\n * The pet's photo\n *\n * @memberof IFormData\n * @member {IOnCropFunctionResults} photo\n */\n photo: IOnCropFunctionResults;\n /**\n * The date the pet was lost\n *\n * @memberof IFormData\n * @member {string} foundDate\n */\n foundDate: string;\n /**\n * The gender of the pet\n *\n * @memberof IFormData\n * @member {PetSex | UnknownValueType} typeOfPet\n */\n typeOfPet: PetSex | UnknownValueType;\n /**\n * The optional microchip id\n *\n * @memberof IFormData\n * @member {string} [microchip]\n */\n microchip?: string;\n /**\n * The optional pet description\n *\n * @memberof IFormData\n * @member {string} [description]\n */\n description?: string;\n /**\n * Text Alerts\n *\n * @memberof IFormData\n * @member {boolean} textAlerts\n */\n textAlerts: boolean;\n /**\n * Email Alerts\n *\n * @memberof IFormData\n * @member {boolean} emailAlerts\n */\n emailAlerts: boolean;\n}\n\n/**\n * GeoPoints\n *\n * @interface IGeoPoints\n */\ninterface IGeoPoints {\n /**\n * The latitude\n *\n * @memberof IGeoPoints\n * @member {number} latitude\n */\n latitude: number;\n /**\n * The longitude\n *\n * @memberof IGeoPoints\n * @member {number} longitude\n */\n longitude: number;\n}\n\n/**\n * The interface for the storage of the I Found A Pet Form.\n *\n * @interface IFoundPetDataStorage\n */\ninterface IFoundPetDataStorage {\n /**\n * The address of the pet\n *\n * @memberof IFoundPetDataStorage\n * @member {ILocationDto} place\n */\n place: ILocationDto;\n /**\n * The address of the pet\n *\n * @memberof IFoundPetDataStorage\n * @member {IGeoPoints} geolocation\n */\n geolocation: IGeoPoints;\n /**\n * The photo of the pet\n *\n * @memberof IFoundPetDataStorage\n * @member {IOnCropFunctionResults} [photo]\n */\n photo?: IOnCropFunctionResults;\n\n /**\n * The cross streets associated with pet\n *\n * @memberof IFoundPetDataStorage\n * @member {string} [crossStreets]\n */\n crossStreets?: string;\n}\n\n/**\n * The class used to track the login state\n *\n * @constant {LoggedInStore}\n */\nconst loggedInStore = new LoggedInStore();\n\n/**\n * Create Account Found Distance Page\n *\n * @param {ICreateAccountFoundDistanceForm} props - The props\n * @returns {NextPage<ICreateAccountFoundDistanceForm>} - The I Found a Pet Form\n * Page\n */\nconst CreateAccountFoundDistanceForm: NextPage<\n ICreateAccountFoundDistanceForm\n> = ({ pageId, featureFlags }: ICreateAccountFoundDistanceForm) => {\n const router = useRouter();\n const { dispatch } = useToastContext();\n /** The loading state - Disables the submit button */\n const [loading, setLoading] = useState(false);\n /** The address from storage required to create an account */\n const [address, setAddress] = useState<ILocationDto>();\n const [crossStreets, setCrossStreets] = useState<string | undefined>('');\n const { storeNewPet } = useStorePets({});\n const [showTransition, setShowTransition] = useState(false);\n const [interstitialSlides, setInterstitialSlides] =\n useState<null | IPartnerInterstitial>(null);\n const { getInitiatingComponent } = useEventContext();\n\n const saveToastToStorage = useSaveToastToStorage();\n const { getReferral } = useShelterReferral();\n\n useEffect(() => {\n /** Get the persistent form data from storage */\n const foundPetData = iFoundAPetStorage.get(\n iFoundAPetStorageKey\n ) as IFoundPetDataStorage;\n if (foundPetData && foundPetData.place) {\n sendStartReportPetEvent(foundPetData.place.postalCode);\n setAddress(foundPetData.place);\n setCrossStreets(foundPetData.crossStreets);\n } else {\n router.push('/create-account/start');\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n /**\n * Collect the data and send it to google analytics for start report pet event\n *\n * @param {string} zip - The zip code\n */\n const sendStartReportPetEvent = (zip?: string) => {\n const data: IStartReportPetEventData = {\n clickText: 'Sign Up',\n context: 'Add Pet',\n petStatus: 'Found',\n locationId: zip,\n component: getInitiatingComponent(),\n };\n\n startReportPetEventHandler(data);\n };\n\n /**\n * Handles the toast\n *\n * @param {ToastType} type - The type of toast\n * @param {string} message - The message of the toast\n * @returns {void} - The toast\n */\n const handleToast = useCallback(\n (type: ToastType, message: string): void => {\n dispatch({\n type: 'ADD_TOAST',\n toast: {\n id: '1',\n type: type,\n message: message,\n persistent: false,\n showIcon: true,\n },\n });\n },\n [dispatch]\n );\n\n const { trackingParams } = useGATrackingParams({ getOnLoad: true });\n\n // Check if the pet is on the social target market\n const { isPetOnSocialTargetMarket } = useCheckSocialTargetMarket({\n location: address,\n });\n\n /**\n * On Submit\n *\n * @param {IFormData} data - The data from the form\n * @returns {void}\n */\n const onSubmit = useCallback(\n async (data: IFormData): Promise<void> => {\n setLoading(true);\n\n if (data.emailAlerts === undefined) {\n data.emailAlerts = true;\n }\n if (data.textAlerts === undefined) {\n data.textAlerts = true;\n }\n\n const listingType = 'foundUserPet';\n try {\n /** Get all required data from the Create Account Found Form */\n const {\n email,\n password,\n firstName,\n lastName,\n phone,\n foundDate,\n typeOfPet,\n microchip,\n description,\n } = data;\n const objectKey = data.photo?.objectKey;\n const species = data.photo?.species;\n /**\n * The instance of the pet create data class\n *\n * @constant {PetCreateData}\n */\n const petCreate = new PetCreateData({\n listingType,\n location: address as ILocationDto,\n date: foundDate,\n typeOfPet,\n microchip,\n description,\n species,\n photos: [objectKey],\n });\n\n /**\n * The data to register user with pet\n *\n * @constant {IRegisterWithPetRequestData}\n */\n const registerWithPetData: IRegisterWithPetRequestData = {\n user: {\n email,\n password: password,\n first_name: firstName,\n last_name: lastName,\n phone_number: phone,\n flow_type: createAccountEventFlowType,\n },\n pet: petCreate.dataForRegistration,\n petAlerts: {\n email: data.emailAlerts,\n sms: data.textAlerts,\n },\n };\n\n registerWithPetData.analytics = {\n google_analytics: {\n ...getGATrackingParams(trackingParams),\n client_id: getClientIdFromCookie(),\n },\n click_text: defaultSubmitLabel,\n };\n\n /**\n * The shelter referral\n *\n * @constant {number | null | undefined}\n */\n const referral = getReferral();\n\n // Append shelter referral if it exists\n if (referral) {\n registerWithPetData.referring_shelter_id = referral;\n }\n\n // Append cross streets if exists\n if (crossStreets) {\n registerWithPetData.cross_streets = crossStreets;\n }\n\n /** The request to register user with pet */\n const {\n statusCode: registerWithPetStatusCode,\n data: registerWithPetResponseData,\n } = await registerWithPet(registerWithPetData);\n\n /** If the new user fails throw an error */\n if (registerWithPetStatusCode !== 200)\n throw new Error('We were unable to register your account');\n\n /** @property {number} userEntityId - The user entity id */\n const {\n user: { id: userEntityId },\n pet: {\n entity: { id: petEntityId },\n },\n } = registerWithPetResponseData;\n\n /** Send the user signup event to google analytics */\n userSignUpEventHandler({\n clickText: submitLabel,\n flowType: createAccountEventFlowType,\n petListingType: listingType,\n species: species,\n postalCode: address?.postalCode,\n });\n\n /** Send the add pet event to google analytics */\n addPetEventHandler({\n clickText: 'Submit',\n context: 'Sign Up Flow',\n petStatus: 'Found',\n listingSource: 'Consumer Pet Listing',\n species,\n locationId: address?.postalCode,\n });\n\n /** Send the upload photo event to google analytics */\n uploadPhotoEventHandler({\n clickText: 'Submit',\n petStatus: 'Found',\n listingSource: 'Consumer Pet Listing',\n species,\n locationId: address?.postalCode,\n });\n\n /** Send the report pet event to google analytics */\n reportPetEventHandler({\n clickText: defaultSubmitLabel,\n context: 'Add Pet',\n petListingType: listingType,\n species: species,\n locationId: address?.postalCode,\n component: getInitiatingComponent(),\n });\n\n const formattedSpecies = species.toLowerCase() as PetSpecies;\n\n /**\n * Store the created pet to handle any possible delay on the creation of\n * this pet\n */\n storeNewPet({ id: petEntityId, ...petCreate.dataForStorage });\n\n /** Clear i-found-a-pet form data */\n clearFormData(iFoundAPetStorageKey, iFoundAPetStorage);\n clearAllFormRelatedData(iFoundAPetFormStorageKey, iFoundAPetStorage);\n\n saveToastToStorage('success', 'Successfully created Found pet.');\n\n /** Sets the login flag in session storage */\n loggedInStore.setLoggedIn(userEntityId);\n\n let redirectUrl = `/dash/pet/${petEntityId}/?isNewAccount=true`;\n if (microchip && featureFlags?.includes(flagMicrochipCreationSearch)) {\n const result = await microchipResultsUrl(microchip, {\n species: formattedSpecies,\n searchType: 'lost',\n });\n if (result) {\n setInterstitialSlides(noPartnerInterstitialMicrochipMatch);\n redirectUrl = result + '?match=true';\n setShowTransition(true);\n setTimeout(() => {\n loginAndRedirect({ email, password, redirectPath: redirectUrl });\n }, getInterstitialDuration(noPartnerInterstitialMicrochipMatch.slides.length));\n return;\n }\n }\n loginAndRedirect({ email, password, redirectPath: redirectUrl });\n } catch (e) {\n console.error(e);\n handleToast('error', 'Failed to create Found pet.');\n router.push('/create-account/start');\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n address,\n featureFlags,\n getReferral,\n handleToast,\n router,\n saveToastToStorage,\n storeNewPet,\n trackingParams,\n ]\n );\n\n return (\n <MultiPageFormProvider\n formId={formId}\n pageId={pageId}\n featureFlags={featureFlags}\n formContext={{\n isTargetMarket: isPetOnSocialTargetMarket,\n }}\n >\n <Head\n title=\"Create An Account Found Pet Distance Search\"\n noIndex={true}\n />\n {showTransition && interstitialSlides && (\n <div className=\"px-6 sm:px-8 md:px-16 h-screen flex items-start justify-center pt-28 sm:pt-40\">\n <PartnerInterstitial {...interstitialSlides} />\n </div>\n )}\n {!showTransition && (\n <StepperFormTemplate\n key={pageId}\n loading={loading}\n submitFunction={onSubmit}\n submitButtonDisabled={loading}\n defaultValues={{ emailAlert: true, textAlert: true }}\n />\n )}\n </MultiPageFormProvider>\n );\n};\n\nexport default CreateAccountFoundDistanceForm;\n\n/**\n * Get Server Side Props This function is used to populate the form found in the\n * context params of the url path.\n *\n * @param {GetServerSidePropsContext} context - The context of the page\n * @returns {GetServerSideProps} The props of the page\n */\nexport const getServerSideProps: GetServerSideProps = async (\n context: GetServerSidePropsContext\n) => {\n const featureFlags = await serverSideAllDecisions(context);\n const idToken = await getIdTokenSSR(context.req, context.res);\n // This page is only accessible if the user is not logged in\n if (idToken) {\n const user = await getMe(idToken);\n const userId = user.user.id;\n if (userId) {\n return {\n redirect: {\n destination: '/dash',\n permanent: false,\n },\n };\n }\n }\n\n const pageId = context.params?.pageId as PageTypes;\n const page = pageId[0];\n return {\n props: {\n pageId: page,\n featureFlags,\n },\n };\n};\n"],"names":["module","exports","__webpack_require__","window","__NEXT_P","push","shelterDetailsArticlesSlugNames","foundSearchArticleSlugNames","lostSearchArticleSlugNames","microchipSearchArticlesSlugNames","getIdTokenClient","response","fetch","concat","getBasePath","jsonResponse","json","Promise","resolve","session","idToken","error","reject","getMe","authToken","me","sdk","read","data","registerWithPet","StorybookContext","createContext","isStorybook","SessionStorage","useStorybookAuthContext","storybookContext","useContext","meStorage","meStorageKey","set","expires","tomorrow","delete","get","me_useMe","setIdToken","useState","setMe","isFetchingUser","setIsFetchingUser","isError","setIsError","errorMessage","setErrorMessage","user","isLoading","useUser","router","useRouter","type","setBannerData","usePersistentBannerContext","idTokenOverride","useEffect","then","catch","message","storedMe","email","finally","id","dataLayer","userAlreadySet","some","el","user_id","BannerStorage","storage","LocalStorage","key","PersistentBannerContext","undefined","bannerProps","PersistentBannerProvider","param","children","setType","setBannerProps","react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__","jsx","Provider","value","LoggedInStore","setLoggedIn","userId","init","getLoggedIn","login","clearLoggedIn","constructor","startPetSearchEventHandler","clickText","flow","component","defaultEventEmitter","handleEvent","name","click_text","flow_type","userSignUpEventHandler","flowType","petId","petName","petListingType","species","postalCode","eventData","items","listing_source","pet_id","notApplicableString","pet_name","pet_status","petListingTypeToPetStatusMap","capitalizeFirstLetter","location_id","loginBasePath","getLoginAndRedirectUrl","password","redirectPath","queryString","encodeURIComponent","loginAndRedirect","location","href","params","getBaseUrl","process","getOwnerTypeSegment","ownerType","listingType","toLowerCase","includes","petUrlPathOwnerTypes","getPetUrlPath","excludeBasePath","ownerTypeSegment","searchTypeSegment","petUrlPathSearchTypes","searchType","petType","getPetUrl","url","source","URLSearchParams","append","toString","idForRelativeLink","Number","ownerTypeForLink","isNaN","formId","createAccountEventFlowType","loggedInStore","__webpack_exports__","pageId","featureFlags","dispatch","useToastContext","loading","setLoading","address","setAddress","crossStreets","setCrossStreets","storeNewPet","useStorePets","showTransition","setShowTransition","interstitialSlides","setInterstitialSlides","getInitiatingComponent","useEventContext","saveToastToStorage","useSaveToastToStorage","getReferral","useShelterReferral","foundPetData","iFoundAPetStorage","iFoundAPetStorageKey","place","sendStartReportPetEvent","context","petStatus","locationId","zip","startReportPetEventHandler","handleToast","useCallback","toast","persistent","showIcon","trackingParams","useGATrackingParams","getOnLoad","isPetOnSocialTargetMarket","useCheckSocialTargetMarket","onSubmit","emailAlerts","textAlerts","firstName","lastName","phone","foundDate","typeOfPet","microchip","description","objectKey","photo","petCreate","PetCreateData","date","photos","registerWithPetData","first_name","last_name","phone_number","pet","dataForRegistration","petAlerts","sms","analytics","google_analytics","getGATrackingParams","client_id","getClientIdFromCookie","defaultSubmitLabel","referral","referring_shelter_id","cross_streets","statusCode","registerWithPetStatusCode","registerWithPetResponseData","userEntityId","entity","petEntityId","submitLabel","addPetEventHandler","listingSource","uploadPhotoEventHandler","reportPetEventHandler","formattedSpecies","dataForStorage","clearFormData","clearAllFormRelatedData","iFoundAPetFormStorageKey","redirectUrl","flagMicrochipCreationSearch","result","microchipResultsUrl","noPartnerInterstitialMicrochipMatch","setTimeout","getInterstitialDuration","slides","length","e","jsxs","MultiPageFormProvider","formContext","isTargetMarket","Head","title","noIndex","div","className","PartnerInterstitial","StepperFormTemplate","submitFunction","submitButtonDisabled","defaultValues","emailAlert","textAlert"],"sourceRoot":""}